﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GestureLib;
using PowerPoint = Microsoft.Office.Interop.PowerPoint;

namespace PowerPointController
{
    class PowerPointSlideViewAction : IGestureAction
    {
        public enum SlideAction
        {
            NextSlide,
            PreviousSlide,
            FirstSlide,
            LastSlide,
            Exit
        }
        //Creates a invisible instance of powerpoint
        public PowerPoint.Application PowerPointApplication { get; set; }
        public SlideAction Action { get; set; }

        #region IGestureAction Members

        public void Execute()
        {
            foreach (PowerPoint.SlideShowWindow sw in PowerPointApplication.SlideShowWindows)
            {
                switch (Action)
                {
                    case SlideAction.NextSlide:
                        sw.View.Next();
                        break;
                    case SlideAction.PreviousSlide:
                        sw.View.Previous();
                        break;
                    case SlideAction.FirstSlide:
                        sw.View.First();
                        break;
                    case SlideAction.LastSlide:
                        sw.View.Last();
                        break;
                    case SlideAction.Exit:
                        sw.View.Exit();
                        break;
                    default:
                        break;
                }
            }
        }

        #endregion

        #region INamed Members

        public string Name { get; set; }

        #endregion
    }
}
